package com.ledtechdesign.beans.api.pojo;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.ledtechdesign.beans.api.BeanBase;
import com.ledtechdesign.beans.api.INode;
import com.ledtechdesign.beans.api.IRepository;

public class Repository extends BeanBase implements IRepository {

	public List<INode> children;

	public int childrenCount;
	public String href;

	public INode topNode;
	public int totalChildren;

	public Repository() {
		super();
		this.children = new ArrayList<INode>();
	}

	public void addChildren(AFCSNode c) {
		this.children.add(c);
	}

	public List<INode> getChildren() {
		return this.children;
	}

	public int getChildrenCount() {
		return this.childrenCount;
	}

	public String getHref() {
		return this.href;
	}

	public INode getTopNode() {
		return this.topNode;
	}

	public int getTotalChildren() {
		return this.totalChildren;
	}

	public void setChildren(List<INode> children) {
		this.children = children;
	}

	public void setChildrenCount(int childrenCount) {
		this.childrenCount = childrenCount;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public void setTopNode(INode topNode) {
		this.topNode = topNode;
	}

	public void setTotalChildren(int totalChildren) {
		this.totalChildren = totalChildren;
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("Repository href#" + this.href);
		sb.append("\n\r");
		sb.append("Repository childrenCount#" + this.childrenCount);
		sb.append("\n\r");
		sb.append("Repository totalChildren#" + this.totalChildren);
		sb.append("\n\r");
		sb.append("--topNode--");
		sb.append("\n\r");
		sb.append(this.topNode.toString());
		sb.append("\n\r");
		sb.append("--End topNode--");
		sb.append("\n\r");
		sb.append("--Children------");
		sb.append("\n\r");
		for (Iterator<INode> iterator = this.children.iterator(); iterator
				.hasNext();) {
			INode n = iterator.next();
			sb.append(n.toString());
			sb.append("\n\r");
		}
		sb.append("--End Children------");
		sb.append("\n\r");
		return sb.toString();
	}

}
